@model dynamic

@{
    ViewData["Title"] = "学生详情";
}

<h1>学生详情</h1>

<div>
    <h4>学生信息</h4>
    <hr />
    <dl class="row">
        <dt class="col-sm-2">
            姓
        </dt>
        <dd class="col-sm-10">
            @Model.LastName
        </dd>
        <dt class="col-sm-2">
            名
        </dt>
        <dd class="col-sm-10">
            @Model.FirstName
        </dd>
        <dt class="col-sm-2">
            入学日期
        </dt>
        <dd class="col-sm-10">
            @Model.EnrollmentDate.ToString("yyyy-MM-dd")
        </dd>
    </dl>
</div>

@if (Model.Enrollments != null && Model.Enrollments.Count > 0)
{
    <div>
        <h4>选课记录</h4>
        <table class="table table-striped">
            <thead>
                <tr>
                    <th>课程编号</th>
                    <th>课程名称</th>
                    <th>成绩</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var enrollment in Model.Enrollments)
                {
                    <tr>
                        <td>@enrollment.CourseID</td>
                        <td>@enrollment.Title</td>
                        <td>@(enrollment.Grade?.ToString() ?? "暂无成绩")</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>
}

<div>
    <a asp-action="Edit" asp-route-id="@Model.ID" class="btn btn-primary">编辑</a>
    <a asp-action="Index" class="btn btn-secondary">返回列表</a>
</div> 